The concept of video compression is to omit certain data of an image that are imperceptible to human's eyes, i.e. so-called visual redundancy. The data to be omitted are generally similar to other data in space or time dimension, and thus can be removed according to a compression algorithm. H.264/AVC is one of the mainstream standards of video compression. Compared with conventional digital video compression standards, such as MPEG-2, MPEG-4 or H.263, H.264 exhibits higher compression performance, and nevertheless reaches better image quality under the same compression ratio.
The coding mechanism of H.264/AVC compression is block-based. In brief, an image frame is divided into a plurality of rectangular areas called as macroblocks (MB). The macroblocks are then encoded. First, intra-frame prediction and inter-frame prediction techniques are applied to remove the similarities between images so as to obtain the so-called residual differences. Then the residual differences are spatially transformed and quantized to remove the visual redundancy. For the intra-prediction of H.264/AVC, three types are provided: intra—4×4, intra—8×8 and intra 16×16. For intra—4×4, the basic unit is a Luma 4×4 sub-block. Upon finding a reference predictor, the residual image is obtained by subtracting the original image with the reference predictor then applied with transformation. The prediction mode for finding the reference predictor may lie in 9 different directions, denoted as prediction mode 0˜8 as shown in FIG. 1A. Prediction mode 2 represents a DC mode, which means no change exists between images.
Therefore, during the H.264/AVC decoding process, a decoder needs to find a prediction mode parameter that represents the prediction mode of a block. Because various decoding algorithms may be used, the decoder must determine the prediction mode parameters of the blocks at the left of and upper to the block being processed so as to determine the prediction mode parameter of the block. A conventional method for determining the prediction mode parameter of a given block is described as follows.
Referring to FIG. 1B, a plurality of macroblocks in H.264 is illustrated. Each macroblock is sub-divided into M×N blocks K11˜Kmn.
FIG. 1C illustrates a 4×4 intra-MB being divided in to M×N blocks. Each of the macroblock is sub-divided into 16 blocks denoted as block 0˜15. Each of the blocks contains 4×4 pixels. At first, a most possible prediction mode parameter (mostPredMode) of a given 4×4 block is determined according to the prediction mode parameters of the neighboring left and upper blocks. Then a previous intra prediction mode flag (pre_intra_pred_mode_flag) is inserted to the 4×4 block from the bit-stream. The length of pre_intra_pred_mode_flag is 1 bit. If pre_intra_pred_mode_flag is 1, then the prediction mode parameter of the given block is set to the most possible prediction mode parameter (mostPredMode). If the previous intra prediction mode flag is 0, another parameter remaining intra prediction mode (rem_intra_pred_mode) is also referenced. The rem_intra_pred_mode parameter is 3 bits in length. In the case that the rem_intra_pred_mode parameter is less than mostPredMode, the prediction mode parameter is set to the rem_intra_pred_mode parameter for the given block. In the case that the rem_intra_pred_mode parameter is larger than the mostPredMode parameter, the prediction mode parameter is set to (rem_intra_pred_mode parameter+1) for the given block. In addition, FIG. 1B also illustrates neighboring left and upper macroblocks A and B of the 16×16 macroblock respectively.
Referring back to FIG. 1B, it can be realized that the neighboring macroblocks A and B may or may not exist. Meanwhile, macroblocks A and B may be intra-MB or inter-MB, and they may be sub-divided into 4×4, 8×8 or 16×16 blocks. Consequently, the prediction mode parameters predA and predB of the neighboring left and upper blocks need to be determined prior to the determination of the prediction mode parameter for the given block. To obtain prediction mode parameters of the neighboring left and upper blocks, the following conditions are considered.
A DC prediction mode flag (dcPredModePredictedFlag) of the given block is set to 1 in the case that any of conditions is true:    1. The neighboring left macroblock A of the current macroblock does not exist;    2. The neighboring upper macroblock B of the current macroblock does not exist;    3. Macroblock A exists but is an inter-MB, and a constrained intra prediction flag (constrained_intra_pred_flag) corresponding to the given block is 1; and    4. Macroblock B exists but is an inter-MB, and a constrained intra prediction flag (constrained_intra_pred_flag) corresponding to the given block is 1.
For any of the 4 conditions being true, it indicates that the prediction mode parameter predA/predB of the neighboring left/upper macroblock A/B does not possess any reference value. Therefore, the prediction mode parameters predA and predB are both set to 2 (DC mode) for the given block when dcPredModePredictedFlag is set to 1.
In the case that none of the 4 conditions is true, (i.e. all false), the DC prediction mode flag (dcPredModePredictedFlag) of the given block is set to 0. The following determination is made subsequently.    1. predA is set to the 4×4 prediction mode parameter of the neighboring left macroblock A in the case that macroblock A is an intra-4×4 MB;    2. predA is set to the 8×8 prediction mode parameter of the neighboring left macroblock A in the case that macroblock A is an intra-8×8 MB;    3. predA is set to 2 in the case that the neighboring left macroblock A is neither intra-4×4 nor intra-8×8 MB;    4. predB is set to the 4×4 prediction mode parameter of the neighboring upper macroblock B in the case that macroblock B is an intra-4×4 MB;    5. predB is set to the 8×8 prediction mode parameter of the neighboring upper macroblock B in the case that macroblock B is an intra-8×8 MB; and    6. predB is set to 2 in the case that the neighboring macroblock B is neither intra-4×4 nor intra-8×8 MB.
“Intra-4×4 MB” denotes a macroblock that is an intra MB and subdivided into 4×4. “Intra-8×8 MB” denotes a macroblock that is an intra MB and subdivided into 8×8.
Once predA and pred B of the neighboring left and upper macroblocks are obtained, the procedure continues to steps below.
First, determine a most possible prediction mode parameter (mostPredMode) for the given block, which is the minimum value chosen from predA and predB, i.e.
MostPredMode=min (predA, predB).
Next, consider the previous intra prediction mode flag (pred_intra_pred_mode_flag) according to the following:    1. For pred_intra_pred_mode_flag=1,            predMode=MostPredMode; and            2. For pred_intra_pred_mode_flag=0,
a. predMode=rem_intra_pred_mode in the case that rem_intra_pred_mode corresponding to the given block is less than mostPredMode; or
b. predMode=(rem-intra_pred_mode+1) in the case that rem_intra_pred_mode corresponding to the given block is larger than mostPredMode.
However, the processing procedure may be complex and time consuming if all of above steps are repeated for every block. Consequently the hardware resource is occupied. As a result, there exists the need to overcome such deficiency.